<div class="row-fluid">
        <div class="span6">
                <div class="box">
                        <div class="box-head">
                                <h3>App views</h3>
                        </div>
                        <div class="box-content">
                                <div class="flot flot-line-appviews"></div>
                        </div>
                </div>
        </div>
        <div class="span6">
                <div class="box">
                        <div class="box-head">
                                <h3>Contributions</h3>
                        </div>
                        <div class="box-content">
                                <div class="flot flot-line-contributions"></div>
                        </div>
                </div>
        </div>
</div>



<script type="text/javascript">
    // set up data
    var indexchartlinedata = [];
    var xticks = [];
    <?php 
    $min = $view->appviews[0]['totalrecords'];
    $max = $view->appviews[0]['totalrecords'];
    foreach($view->appviews as $k => $v) { 
        if($v['totalrecords'] > $max){
            $max = $v['totalrecords'];
        }
        if($v['totalrecords'] < $min){
            $min = $v['totalrecords'];
        }
        $v['date_time'] = date("dS M", $v['date_time']);
        ?>
        indexchartlinedata.push([<?php echo $k;?>, <?php echo $v['totalrecords'];?>]);
        xticks.push([<?php echo $k;?>,'<?php echo $v['date_time'];?>']);
    <?php } ?>
    var indexchartlineoptions = {
			series: {
				lines: { show: true },
				points: { show: true }
			},
			grid: {
				hoverable: true,
				clickable: true
			},
                        xaxis: {
                            ticks: xticks
                        },
			yaxis: { min: <?php echo $min;?>, max: <?php echo $max;?> },
			colors: [ '#2872bd', '#666666', '#feb900', '#128902', '#c6c12f']
		};
    
    var contributionschartdata = [];
    var xtickscontributions = [];
    <?php 
    $minc = $view->contributions[0]['totalrecords'];
    $maxc = $view->contributions[0]['totalrecords'];
    foreach($view->contributions as $k => $v) { 
        if($v['totalrecords'] > $maxc){
            $maxc = $v['totalrecords'];
        }
        if($v['totalrecords'] < $minc){
            $minc = $v['totalrecords'];
        }
        $v['date_time'] = date("dS M", $v['date_time']);
        ?>
        contributionschartdata.push([<?php echo $k;?>, <?php echo $v['totalrecords'];?>]);
        xtickscontributions.push([<?php echo $k;?>,'<?php echo $v['date_time'];?>']);
    <?php } ?>
    var contributionschartdataoptions = {
			series: {
				lines: { show: true },
				points: { show: true }
			},
			grid: {
				hoverable: true,
				clickable: true
			},
                        xaxis: {
                            ticks: xtickscontributions
                        },
			yaxis: { min: <?php echo $minc;?>, max: <?php echo $maxc;?> },
			colors: [ '#2872bd', '#666666', '#feb900', '#128902', '#c6c12f']
		};
</script>